<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>cors之cookie</title>
</head>

<body>

  <script>
    document.cookie = 'name=lisi;path=/'
    /* let xhr = new XMLHttpRequest()
    // xhr在异步请求时允许携带cookie
    xhr.withCredentials = true
    xhr.open('get', 'http://localhost:3000', true)
    xhr.onload = function () {
      console.log(xhr.responseText)
    }
    xhr.send(null) */

    /* fetch('http://localhost:3000',{
      credentials:true
    }) */
  </script>
</body>

</html>